package com.chenjian.designpattern.strategy;

/**
 * 策略模式的上下文
 * <p>
 * 封装策略角色，承上启下，屏蔽高层对策略模块的直接访问
 *
 * @author TC2952
 */
public class Does {

    private String others;

    private double num;


    private AbstractStrategy abstractStrategy;

    public Does(String others, double num, AbstractStrategy abstractStrategy) {
        this.others = others;
        this.num = num;
        this.abstractStrategy = abstractStrategy;
    }

    public double doS() {
        double res = abstractStrategy.doRes(this.num);
        System.out.println(abstractStrategy.getDesc());
        return res;
    }
}
